#define  _CRT_SECURE_NO_WARNINGS 1	
#include <stdio.h>
#include<string.h>
void reserve(char* start, char* end)
{
    while (start < end)
    {
        char tmp = *start;
        *start = *end;
        *end = tmp;
        start++;
        end--;
    }
}
int main() {
    char arr[101];
    gets(arr);
    int len = strlen(arr);
    char* start = arr;
    char* end = arr + len - 1;
    reserve(start, end);
    start = arr;
    while (*start)
    {
        end = start;
        while (*end != ' ' && *end != '\0')
        {
            end++;
        }
        reserve(start, end - 1);
        if (*end != '0')
            end++;
        start = end;
    }
    return 0;
}